package cloud.daodao.storm.common.security.model.secret;

import cloud.daodao.storm.common.constant.AppConstant;
import cloud.daodao.storm.common.serialize.Serializer;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author DaoDao
 */
@Schema(title = "RsaData", description = "RSA 数据")
@Data
public class RsaData implements Serializer {

    @Schema(title = "id", description = "对方编码标识 id 全局唯一不重复", example = "100000000000000000")
    @NotEmpty
    @Size(min = 18, max = 18)
    @Pattern(regexp = "^\\d+$")
    private String id;

    @Schema(title = "我方公钥，服务端公钥", description = "我方公钥，用于对方处理我方的数据时的加密和验签，由我方生成，密送予对方，私密保管", example = "1")
    @NotEmpty
    @Size(min = 1, max = 1024)
    private String serverPublicKey;

    @Schema(title = "我方私钥，服务端私钥", description = "我方私钥，用于我方处理对方的数据时的解密和加签，由我方私密保管，不对外暴露", example = "")
    @NotEmpty
    @Size(min = 1, max = 2048)
    private String serverPrivateKey;

    @Schema(title = "对方公钥，客户端公钥", description = "对方公钥，用于我方处理对方的数据时的加密和验签，由对方生成，密送予我方，私密保管", example = "")
    @NotEmpty
    @Size(min = 1, max = 1024)
    private String clientPublicKey;

    @Schema(title = "createTime", description = "创建时间", example = AppConstant.DATE_TIME_EXAMPLE)
    @NotNull
    private LocalDateTime createTime;

    @Schema(title = "updateTime", description = "更新时间", example = AppConstant.DATE_TIME_EXAMPLE)
    @NotNull
    private LocalDateTime updateTime;

    @Schema(title = "valid", description = "是否有效", example = "true")
    @NotNull
    private Boolean valid;

}
